<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"          			
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      >
    <ui:composition template="TaskProLayout.xhtml">
        <ui:define name="content">
            <div class="Post">
                <h:form id="subject">  
                    <p:dataTable   var="sub" value="#{kantorTaskBean.kantorSubjects}"  
                                   selection="#{kantorTaskBean.selectedSubjects}" selectionMode="multiple"
                                   rowKey="#{sub.code}" paginator="true" paginatorAlwaysVisible="false" rows="10">  
                        <f:facet name="header">  
                            Choose subject 
                        </f:facet>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Subject code" />  
                            </f:facet>  
                            <h:outputText value="#{sub.code}" />  
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Subject descriptioon" />  
                            </f:facet>  
                            <h:outputText value="#{sub.description}" >
                                <f:converter converterId="StringConverter" />
                            </h:outputText>
                        </p:column>  
                        <f:facet name="footer">
                            <p:commandButton value="Choose"  update=":paralelkyForm,:teamForm" ajax="true" action="#{kantorTaskBean.filterBySubjects()}"/>  
                        </f:facet>  
                    </p:dataTable>  
                </h:form>
            </div>
            <div class="Post">
                <h:form id="paralelkyForm" >
                    <p:dataTable               
                        var="group" value="#{kantorTaskBean.kantorGroups}"  
                        selection="#{kantorTaskBean.selectedGroup}" selectionMode="multiple"
                        rowKey="#{group.id}" paginator="true" paginatorAlwaysVisible="false" rows="10">  
                        <f:facet name="header">  
                            <h:outputText value="Current choose groups" />
                        </f:facet>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Group code" />  
                            </f:facet>  
                            <h:outputText value="#{group.code}" />  
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Groups subject" />  
                            </f:facet>  
                            <h:outputText value="#{group.subject.code}" />  
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Start time" />  
                            </f:facet>  
                            <h:outputText value="#{group.startTime}" >
                                <f:convertDateTime type="time" timeZone="Europe/Prague"></f:convertDateTime>
                            </h:outputText>
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Stop time" />  
                            </f:facet>  
                            <h:outputText value="#{group.stopTime}" >
                                <f:convertDateTime type="time" timeZone="Europe/Prague"></f:convertDateTime>
                            </h:outputText>
                        </p:column> 
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Date of teach" />  
                            </f:facet>  
                            <h:outputText value="#{group.dayOfTeach}" />  
                        </p:column>  
                        <f:facet name="footer">  
                            <p:commandButton value="Choose"   
                                             update=":teamForm,:paralelkyForm" ajax="true" action="#{kantorTaskBean.filterByGroup()}"/>  
                        </f:facet>  
                    </p:dataTable>  
                </h:form> 
            </div>
            <div class="Post">
                <h:form id="teamForm" >
                    <p:dataTable 
                        var="team" value="#{kantorTaskBean.kantorTeam}"   widgetVar="teamFilter"
                        selection="#{kantorTaskBean.selectedTeam}" selectionMode="multiple"
                        rowKey="#{team.id}" paginator="true" paginatorAlwaysVisible="false" rows="10">  
                        <f:facet name="header">  
                            <h:outputText value="Current choose teams"/>
                        </f:facet>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Team name" />  
                            </f:facet>  
                            <h:outputText value="#{team.name}" />  
                        </p:column>  
                        <p:column>  
                            <f:facet name="header">  
                                <h:outputText value="Team´s group" />  
                            </f:facet>  
                            <h:outputText value="#{team.group.code}" />  
                        </p:column>  
                        <f:facet name="footer">  
                            <p:commandButton value="Choose"   
                                             update=":teamForm" ajax="true" action="#{kantorTaskBean.filterByTeam()}"/>  
                        </f:facet>  
                    </p:dataTable>  
                </h:form>  
            </div>
            <div class="Post">
                <h:form>  
                    <p:commandButton value="Next" action="#{kantorTaskBean.loadStudentsToRate()}" ajax="false"></p:commandButton> 
                </h:form>
            </div>
        </ui:define>
    </ui:composition>
</html>